import {
  request_post,
  request_get,
  request_put,
  request_delete
} from "services/common/request";
import pathToRegexp from "path-to-regexp";
let toPathGroup = pathToRegexp.compile("/api/data_articles/groups/:id");
/**
 * 获取场景列表
 * @param {Object} data
 * @param {String} data.name - 选填 名称
 * @param {String} data.pageStart
 * @param {String} data.pageOffset
 * @param {String} data.pageNum
 */
export function getList(data = {}) {
  return request_get("/categoryRelation/get", data);
}

/**
 * 获取场景
 * @param {Object} data
 * @param {String} data.name - 选填 名称
 * @param {String} data.interfaceIds
 * @param {String} data.name
 */
export async function save(data = {}) {
  if (data.id) {
    return request_put("/categoryRelation/update", data);
  }
  return request_post("/categoryRelation/insert ", data);
}

/**
 * 获取详情
 * @param {Object} data
 * @param {String} data.name - 选填 名称
 * @param {String} data.username
 * @param {String} data.password
 */
export function del(data = {}) {
  return request_delete("/categoryRelation/del", data);
}

/**
 * 获取所有场景列表
 * @param {Object} data
 */
export function detail(data = {}) {
  return request_delete("/categoryRelation/getFloorCategoryList", data);
}
